﻿Imports System.Reflection

Public Class Plugin
    Implements UCBase.I_Plugin
    Private DevList As New List(Of UCBase.UCSDevice)
    Private m_Resource As UCBase.ResourceManager

    Public ReadOnly Property Devices() As System.Collections.Generic.List(Of UCBase.UCSDevice) Implements UCBase.I_Plugin.Devices
        Get
            Return DevList
        End Get
    End Property

    Public WriteOnly Property Resources() As UCBase.ResourceManager Implements UCBase.I_Plugin.Resources
        Set(ByVal value As UCBase.ResourceManager)
            m_Resource = value
        End Set
    End Property

    Public Sub Unload() Implements UCBase.I_Plugin.Unload
        Me.Finalize()
    End Sub
    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub
    Public Function GetDevice(ByVal Name As String) As System.Windows.Forms.Control Implements UCBase.I_Plugin.GetDevice
        'If Name = "DeviceName" Then Return New Device 'Get Control from Reference Name
        If Name = "FullScreen" Then Return New FullScreen 'Get Control from Reference Name

        If Name = "TabMonitorB" Then
            Dim X As New TabMonB
            X.Resources = m_Resource
            X.CreateTab()
            Return X
        End If
        If Name = "TabMonitor" Then
            Dim X As New TabMonitor
            X.Resources = m_Resource
            X.CreateTab()
            Return X
        End If

        If Name = "MonitorOSD" Then Return New MonitorOSD 'Get Control from Reference Name
        If Name = "Monitor" Then Return New Monitor 'Get Control from Reference Name

        Return Nothing
    End Function

    Public Sub New()
        'DevList.Add(New UCBase.UniCamDevice("Friendly Name", "Name", "Menu", "Tooltip"))
        DevList.Add(New UCBase.UCSDevice("Full Screen", "FullScreen", "Monitor", "Full Screen"))
        DevList.Add(New UCBase.UCSDevice("Tab Monitor A", "TabMonitor", "Monitor", "Tab Monitor"))
        DevList.Add(New UCBase.UCSDevice("Tab Monitor B", "TabMonitorB", "Monitor", "Tab Monitor"))
        DevList.Add(New UCBase.UCSDevice("Monitor with OSD", "MonitorOSD", "Monitor", "Monitor With OSD"))
        DevList.Add(New UCBase.UCSDevice("Monitor", "Monitor", "Monitor", "Monitor"))

    End Sub
End Class
